package com.crm.kz.menu;

import android.content.Context;
import android.os.Bundle;
import android.util.DisplayMetrics;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import com.crm.kz.R;
import com.crm.kz.common.GlobalVariable;
import com.crm.kz.common.SystemConfig;
import com.xuexiang.xui.widget.actionbar.TitleBar;

public class MainActivity extends AppCompatActivity {

    private Context context = MainActivity.this;
    private TitleBar titleBar;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        DisplayMetrics metric = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(metric);
        setContentView(R.layout.activity_main);
        GlobalVariable.width = metric.widthPixels;

        //初始化全局变量
        SystemConfig.getConfig(this);

//        requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
//
//        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title);
//
        titleBar = findViewById(R.id.titleBar);


        MenuFragment menuFragment = MenuFragment.newInstance();
        LoginFragment loginFragment = new LoginFragment();
        FragmentManager fm = this.getSupportFragmentManager();
        fm.beginTransaction()
                .replace(R.id.fragment_container, menuFragment)
                .commit();
//        GridLayout gl = findViewById(R.id.menuLayout);
//        for (int i = 0; i < 15; i++) {
//            ImageView imageView = new ImageView(this);
//            gl.addView(imageView);
//            imageView.setImageResource(R.mipmap.addjihua);
//            ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams();
//            layoutParams.width = 150;
//            layoutParams.height = 150;
//            imageView.setLayoutParams(layoutParams);
//
//        }

    }


    public TitleBar getTitleBar(){
        return titleBar;
    }

}
